package com.codeplex.tdmg4mc;

import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.item.ItemStack;

import org.lwjgl.opengl.GL11;

import api.player.render.RenderPlayerAPI;
import api.player.render.RenderPlayerBase;
import cpw.mods.fml.common.ModClassLoader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class TDMGRenderPlayer extends RenderPlayerBase
{
	public TDMGRenderPlayer(RenderPlayerAPI api)
	{
		super(api);
	}
	
	@Override
	public void renderSpecials(AbstractClientPlayer var1, float var2)
	{
        ItemStack var3=var1.inventory.getCurrentItem();
		if(var3!=null&&var3.getItem()==TDMG.dualSword)
		{
			renderPlayerAPI.localRenderSpecials(var1, var2);
            GL11.glPushMatrix();
            renderPlayerAPI.getModelBipedMainField().bipedLeftArm.postRender(0.0625f);
            GL11.glTranslatef( 0.0625f, 0.4375f, 0.0625f);
            {
                float var5=0.625f;
                GL11.glTranslatef(0.0f, 0.1875f, 0.0f);
                GL11.glScalef(var5, -var5, var5);
                GL11.glRotatef(-100.0f, 1.0f, 0.0f, 0.0f);
                GL11.glRotatef(40.0f, 0.0f, 1.0f, 0.0f);
            }
            {
	            int var5=var3.getItem().getColorFromItemStack(var3, 0);
	            float var10=(float)(var5>>16&255)/255.0f;
	            float var7=(float)(var5>>8&255)/255.0f;
	            float var8=(float)(var5&255)/255.0f;
	            GL11.glColor4f(var10, var7, var8, 1.0f);
            }
            renderPlayerAPI.getRenderManagerField().itemRenderer.renderItem(var1, var3, 0);
            GL11.glPopMatrix();
		}
		else super.renderSpecials(var1, var2);
	}
}
